/**
 * 
 */
package org.hackystat.projecttrajectory;

import static org.junit.Assert.*;
import org.hackystat.project.ProjectException;
import org.junit.Test;

/**
 * @author Cam Moore
 *
 */
public class TestProjectTrajectoryProperties {
  
  private static final String exceptionError = "Got an exception in " +
  		"ProjectTrajectoryProperties.getInstance()";
  /**
   * Test method for 
   * {@link org.hackystat.projecttrajectory.ProjectTrajectoryProperties#getInstance()}.
   */
  @Test
  public void testGetInstance() {
    try {
      ProjectTrajectoryProperties instance = ProjectTrajectoryProperties.getInstance();
      assertNotNull("Got null", instance);
    } catch (ProjectException e) {
      e.printStackTrace();
      fail(exceptionError);
    }
  }

  /**
   * Test method for 
   * {@link org.hackystat.projecttrajectory.ProjectTrajectoryProperties#getSensorbase()}.
   */
  @Test
  public void testGetSensorbase() {
    try {
      ProjectTrajectoryProperties instance = ProjectTrajectoryProperties.getInstance();
      instance.setTestProperties();
      String sensorbase = instance.getSensorbase();
      assertSame("Got wrong sensorbase URI", "http://localhost:9976/sensorbase", sensorbase);
    } catch (ProjectException e) {
      e.printStackTrace();
      fail(exceptionError);
    }
  }

  /**
   * Test method for 
   * {@link org.hackystat.projecttrajectory.ProjectTrajectoryProperties#getEmail()}.
   */
  @Test
  public void testGetEmail() {
    try {
      ProjectTrajectoryProperties instance = ProjectTrajectoryProperties.getInstance();
      instance.setTestProperties();
      String email = instance.getEmail();
      assertSame("Got wrong user", "admin@hackystat.org", email);
    } catch (ProjectException e) {
      e.printStackTrace();
      fail(exceptionError);
    }
  }

  /**
   * Test method for 
   * {@link org.hackystat.projecttrajectory.ProjectTrajectoryProperties#getPassword()}.
   */
  @Test
  public void testGetPassword() {
    try {
      ProjectTrajectoryProperties instance = ProjectTrajectoryProperties.getInstance();
      instance.setTestProperties();
      String password = instance.getPassword();
      assertSame("Got wrong password", "admin@hackystat.org", password);
    } catch (ProjectException e) {
      e.printStackTrace();
      fail(exceptionError);
    }
  }

  /**
   * Test method for 
   * {@link org.hackystat.projecttrajectory.ProjectTrajectoryProperties#getDailyProjectData()}.
   */
  @Test
  public void testGetDailyProjectData() {
    try {
      ProjectTrajectoryProperties instance = ProjectTrajectoryProperties.getInstance();
      instance.setTestProperties();
      String dpdSensorbase = instance.getDailyProjectData();
      assertSame("Got wrong dpd URI", "http://localhost:9977/dailyprojectdata", dpdSensorbase);
    } catch (ProjectException e) {
      e.printStackTrace();
      fail(exceptionError);
    }
  }

}
